/ To be used with Javascript-Templates (see: https://github.com/blueimp/JavaScript-Templates)
/ The template to display files available for download (the stock one from the jquery-fileupload script)
%script#template-download{:type => "text/x-tmpl"}
  {% for (var i=0, file; file=o.files[i]; i++) { %}
  %tr.template-download.fade
    %td
      %span.preview
        {% if (file.thumbnailUrl) { %}
        %a{:download => "{%=file.name%}", :href => "{%=file.url%}", :title => "{%=file.name%}", :"data-gallery" => ''}
          %img{:src => "{%=file.thumbnailUrl%}"}
        {% } %}
    %td
      %p.name
        {% if (file.url) { %}
        %a{:href => "{%=file.url%}", :title => "{%=file.name%}", :download => "{%=file.name%}", :"data-gallery" => !"{%= file.thumbnailUrl ? ' ' : '' %}".html_safe.empty? && ''} {%=file.name%}
        {% } else { %}
        %span {%=file.name%}
        {% } %}
      {% if (file.error) { %}
      %div
        %span.label.label-danger Error
        {%=file.error%}
      {% } %}
    %td
      %span.size {%=o.formatFileSize(file.size)%}
    %td
      {% if (file.deleteUrl) { %}
      %button.btn.btn-danger.delete{"data-type" => "{%=file.deleteType%}", "data-url" => "{%=file.deleteUrl%}", "data-confirmation" => "Are you sure?", "data-xhr-fields" => !"{% if (file.delete_with_credentials) { %} {'withCredentials': true} {% } %}".blank? && "{% if (file.delete_with_credentials) { %} {'withCredentials': true} {% } %}"}
        %i.glyphicon.glyphicon-trash
        %span Delete
      %input.toggle{:name => "delete", :type => "checkbox", :value => "1"}
      {% } else { %}
      %button.btn.btn-warning.cancel
        %i.glyphicon.glyphicon-ban-circle
        %span Cancel
      {% } %}
  {% } %}
